package demo4.controller;

import demo4.mapper.IUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Scanner;

@Component
public class UserController {
    @Autowired
    private IUserMapper userMapper;
    public void start() {
        System.out.println("请输入序号");
        System.out.println("1.注册，2.登录，3.不到");
        Scanner in = new Scanner(System.in);
        int num=Integer.parseInt(in.nextLine());

        switch (num) {
            case 1:
                System.out.println("注册");
                regUser();
                break;
            case 2:
                System.out.println("登录");
                loginUser();
                break;
            case 3:
                System.out.println("到不了");
                break;
            default:
                System.out.println("输入错误");
                break;
        }
    }
    public void regUser() {
        System.out.println("注册用户");
        userMapper.insert(null);
    }

    public void loginUser() {
        System.out.println("登录用户");
    }
}
